{extend name="layout"/}

{block name="breadcrumb"}
<h2>{$title}</h2>
<ol class="breadcrumb">
    <li><a href="{:url('index/index')}">首页</a></li>
    {if $parentUrl }
    <li><a href="{$parentUrl}">{$parentName}</a></li>
    {/if}
    <li><strong>{$title}</strong></li>
</ol>
{/block}

{block name="search"}
{include file='oauth_order/search'/}
{/block}

{block name="main"}
<div class="ibox float-e-margins">
    <div class="ibox-title">
        <h5>{$title}</h5>
    </div>
    <div class="ibox-content">
        {if ($oauthId > 0) }
        <p>
            <a href="{:url('form', ['oauth_id' => $oauthId])}" class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i> 添加订单</a>
        </p>
        {/if}
        <div class="table-responsive">
            <p>共 {$count} 条订单数据，订单总收入（用户支付）：<span class="text-danger">{$money}</span>，佣金总支出（用户佣金）：<span class="text-danger">{$commission}</span></p>
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>订单号</th>
                    <th>用户昵称</th>
                    <th>订单类型</th>
                    <th>购买语种</th>
                    <th>初级班</th>
                    <th>中级班</th>
                    <th>高级班</th>
                    <th>教导主任</th>
                    <th>积分抵扣</th>
                    <th>优惠券名称</th>
                    <th>优惠券抵扣</th>
                    <th>支付金额</th>
                    <th>支付方式</th>
                    <th>上级用户昵称</th>
                    <th>上级佣金</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {foreach $model as $key=>$vo }
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.order_sn}</td>
                    <td>{$vo.oauth_nickname}</td>
                    <td>{$vo.type}</td>
                    <td>{$vo.lang_id}</td>
                    <td>{$vo.class_1}</td>
                    <td>{$vo.class_2}</td>
                    <td>{$vo.class_3}</td>
                    <td>{$vo.customer_id}</td>
                    <td>{$vo.integral}</td>
                    <td>{$vo.coupon_name}</td>
                    <td>{$vo.coupon}</td>
                    <td>{$vo.pay_money}</td>
                    <td>{$vo.pay_type}</td>
                    <td>{$vo.share_nickname}</td>
                    <td>{$vo.share_commission}</td>
                    <td>{$vo.create_time}</td>
                    <td>
                        <a href="{:url('detail', ['id' => $vo.id, 'detailType' => $detailType])}" class="btn btn-success btn-xs">详情</a>  
                        <a href="javascript:void(0);" data-id="{$vo.id}" class="delete-one btn btn-danger btn-xs">删除</a>
                    </td>
                </tr>
                {/foreach}
                </tbody>
            </table>
            {$model|raw}
        </div>

    </div>
</div>
{/block}

<!-- 加载其他js -->
{block name="jsFile"}
{load href="/static/css/plugins/datetimepicker/bootstrap-datetimepicker.min.css" /}
{load href="/static/js/plugins/datetimepicker/bootstrap-datetimepicker.min.js" /}
<script>
    $('.start-time').datetimepicker({
        weekStart: 1, // 一周从哪一天开始。0（星期日）到6（星期六）
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2, // 日期时间选择器打开之后首先显示的视图 0 hour 1 day 2 month 3 year 4 decade
        forceParse: 1, // 当用户在输入框中输入了不正确的日期，选择器将会尽量解析输入的值
        showMeridian: 1
    });
    $('.end-time').datetimepicker({
        weekStart: 1, // 一周从哪一天开始。0（星期日）到6（星期六）
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2, // 日期时间选择器打开之后首先显示的视图 0 hour 1 day 2 month 3 year 4 decade
        forceParse: 1, // 当用户在输入框中输入了不正确的日期，选择器将会尽量解析输入的值
        showMeridian: 1
    });
</script>
{/block}